
/**
 * This is a generated class and is not intended for modification.  
 */
package valueObjects
{
import com.adobe.fiber.styles.IStyle;
import com.adobe.fiber.styles.Style;
import com.adobe.fiber.styles.StyleValidator;
import com.adobe.fiber.valueobjects.AbstractEntityMetadata;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import mx.events.ValidationResultEvent;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IModelType;
import mx.events.PropertyChangeEvent;

use namespace model_internal;

[ExcludeClass]
internal class _EquipoDTOEntityMetadata extends com.adobe.fiber.valueobjects.AbstractEntityMetadata
{
    private static var emptyArray:Array = new Array();

    model_internal static var allProperties:Array = new Array("idPrestacion", "nombreEquipo", "descripcion", "idEspecialidad", "idEquipo");
    model_internal static var allAssociationProperties:Array = new Array();
    model_internal static var allRequiredProperties:Array = new Array("idPrestacion", "nombreEquipo", "descripcion", "idEspecialidad", "idEquipo");
    model_internal static var allAlwaysAvailableProperties:Array = new Array("idPrestacion", "nombreEquipo", "descripcion", "idEspecialidad", "idEquipo");
    model_internal static var guardedProperties:Array = new Array();
    model_internal static var dataProperties:Array = new Array("idPrestacion", "nombreEquipo", "descripcion", "idEspecialidad", "idEquipo");
    model_internal static var sourceProperties:Array = emptyArray
    model_internal static var nonDerivedProperties:Array = new Array("idPrestacion", "nombreEquipo", "descripcion", "idEspecialidad", "idEquipo");
    model_internal static var derivedProperties:Array = new Array();
    model_internal static var collectionProperties:Array = new Array();
    model_internal static var collectionBaseMap:Object;
    model_internal static var entityName:String = "EquipoDTO";
    model_internal static var dependentsOnMap:Object;
    model_internal static var dependedOnServices:Array = new Array();
    model_internal static var propertyTypeMap:Object;

    
    model_internal var _idPrestacionIsValid:Boolean;
    model_internal var _idPrestacionValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _idPrestacionIsValidCacheInitialized:Boolean = false;
    model_internal var _idPrestacionValidationFailureMessages:Array;
    
    model_internal var _nombreEquipoIsValid:Boolean;
    model_internal var _nombreEquipoValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _nombreEquipoIsValidCacheInitialized:Boolean = false;
    model_internal var _nombreEquipoValidationFailureMessages:Array;
    
    model_internal var _descripcionIsValid:Boolean;
    model_internal var _descripcionValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _descripcionIsValidCacheInitialized:Boolean = false;
    model_internal var _descripcionValidationFailureMessages:Array;
    
    model_internal var _idEspecialidadIsValid:Boolean;
    model_internal var _idEspecialidadValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _idEspecialidadIsValidCacheInitialized:Boolean = false;
    model_internal var _idEspecialidadValidationFailureMessages:Array;
    
    model_internal var _idEquipoIsValid:Boolean;
    model_internal var _idEquipoValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _idEquipoIsValidCacheInitialized:Boolean = false;
    model_internal var _idEquipoValidationFailureMessages:Array;

    model_internal var _instance:_Super_EquipoDTO;
    model_internal static var _nullStyle:com.adobe.fiber.styles.Style = new com.adobe.fiber.styles.Style();

    public function _EquipoDTOEntityMetadata(value : _Super_EquipoDTO)
    {
        // initialize property maps
        if (model_internal::dependentsOnMap == null)
        {
            // dependents map
            model_internal::dependentsOnMap = new Object();
            model_internal::dependentsOnMap["idPrestacion"] = new Array();
            model_internal::dependentsOnMap["nombreEquipo"] = new Array();
            model_internal::dependentsOnMap["descripcion"] = new Array();
            model_internal::dependentsOnMap["idEspecialidad"] = new Array();
            model_internal::dependentsOnMap["idEquipo"] = new Array();

            // collection base map
            model_internal::collectionBaseMap = new Object();
        }

        // Property type Map
        model_internal::propertyTypeMap = new Object();
        model_internal::propertyTypeMap["idPrestacion"] = "String";
        model_internal::propertyTypeMap["nombreEquipo"] = "String";
        model_internal::propertyTypeMap["descripcion"] = "String";
        model_internal::propertyTypeMap["idEspecialidad"] = "String";
        model_internal::propertyTypeMap["idEquipo"] = "String";

        model_internal::_instance = value;
        model_internal::_idPrestacionValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForIdPrestacion);
        model_internal::_idPrestacionValidator.required = true;
        model_internal::_idPrestacionValidator.requiredFieldError = "idPrestacion is required";
        //model_internal::_idPrestacionValidator.source = model_internal::_instance;
        //model_internal::_idPrestacionValidator.property = "idPrestacion";
        model_internal::_nombreEquipoValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForNombreEquipo);
        model_internal::_nombreEquipoValidator.required = true;
        model_internal::_nombreEquipoValidator.requiredFieldError = "nombreEquipo is required";
        //model_internal::_nombreEquipoValidator.source = model_internal::_instance;
        //model_internal::_nombreEquipoValidator.property = "nombreEquipo";
        model_internal::_descripcionValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForDescripcion);
        model_internal::_descripcionValidator.required = true;
        model_internal::_descripcionValidator.requiredFieldError = "descripcion is required";
        //model_internal::_descripcionValidator.source = model_internal::_instance;
        //model_internal::_descripcionValidator.property = "descripcion";
        model_internal::_idEspecialidadValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForIdEspecialidad);
        model_internal::_idEspecialidadValidator.required = true;
        model_internal::_idEspecialidadValidator.requiredFieldError = "idEspecialidad is required";
        //model_internal::_idEspecialidadValidator.source = model_internal::_instance;
        //model_internal::_idEspecialidadValidator.property = "idEspecialidad";
        model_internal::_idEquipoValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForIdEquipo);
        model_internal::_idEquipoValidator.required = true;
        model_internal::_idEquipoValidator.requiredFieldError = "idEquipo is required";
        //model_internal::_idEquipoValidator.source = model_internal::_instance;
        //model_internal::_idEquipoValidator.property = "idEquipo";
    }

    override public function getEntityName():String
    {
        return model_internal::entityName;
    }

    override public function getProperties():Array
    {
        return model_internal::allProperties;
    }

    override public function getAssociationProperties():Array
    {
        return model_internal::allAssociationProperties;
    }

    override public function getRequiredProperties():Array
    {
         return model_internal::allRequiredProperties;   
    }

    override public function getDataProperties():Array
    {
        return model_internal::dataProperties;
    }

    public function getSourceProperties():Array
    {
        return model_internal::sourceProperties;
    }

    public function getNonDerivedProperties():Array
    {
        return model_internal::nonDerivedProperties;
    }

    override public function getGuardedProperties():Array
    {
        return model_internal::guardedProperties;
    }

    override public function getUnguardedProperties():Array
    {
        return model_internal::allAlwaysAvailableProperties;
    }

    override public function getDependants(propertyName:String):Array
    {
       if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a data property of entity EquipoDTO");
            
       return model_internal::dependentsOnMap[propertyName] as Array;  
    }

    override public function getDependedOnServices():Array
    {
        return model_internal::dependedOnServices;
    }

    override public function getCollectionProperties():Array
    {
        return model_internal::collectionProperties;
    }

    override public function getCollectionBase(propertyName:String):String
    {
        if (model_internal::collectionProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a collection property of entity EquipoDTO");

        return model_internal::collectionBaseMap[propertyName];
    }
    
    override public function getPropertyType(propertyName:String):String
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a property of EquipoDTO");

        return model_internal::propertyTypeMap[propertyName];
    }

    override public function getAvailableProperties():com.adobe.fiber.valueobjects.IPropertyIterator
    {
        return new com.adobe.fiber.valueobjects.AvailablePropertyIterator(this);
    }

    override public function getValue(propertyName:String):*
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity EquipoDTO");
        }

        return model_internal::_instance[propertyName];
    }

    override public function setValue(propertyName:String, value:*):void
    {
        if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " is not a modifiable property of entity EquipoDTO");
        }

        model_internal::_instance[propertyName] = value;
    }

    override public function getMappedByProperty(associationProperty:String):String
    {
        switch(associationProperty)
        {
            default:
            {
                return null;
            }
        }
    }

    override public function getPropertyLength(propertyName:String):int
    {
        switch(propertyName)
        {
            default:
            {
                return 0;
            }
        }
    }

    override public function isAvailable(propertyName:String):Boolean
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity EquipoDTO");
        }

        if (model_internal::allAlwaysAvailableProperties.indexOf(propertyName) != -1)
        {
            return true;
        }

        switch(propertyName)
        {
            default:
            {
                return true;
            }
        }
    }

    override public function getIdentityMap():Object
    {
        var returnMap:Object = new Object();

        return returnMap;
    }

    [Bindable(event="propertyChange")]
    override public function get invalidConstraints():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_invalidConstraints;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_invalidConstraints;        
        }
    }

    [Bindable(event="propertyChange")]
    override public function get validationFailureMessages():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
    }

    override public function getDependantInvalidConstraints(propertyName:String):Array
    {
        var dependants:Array = getDependants(propertyName);
        if (dependants.length == 0)
        {
            return emptyArray;
        }

        var currentlyInvalid:Array = invalidConstraints;
        if (currentlyInvalid.length == 0)
        {
            return emptyArray;
        }

        var filterFunc:Function = function(element:*, index:int, arr:Array):Boolean
        {
            return dependants.indexOf(element) > -1;
        }

        return currentlyInvalid.filter(filterFunc);
    }

    /**
     * isValid
     */
    [Bindable(event="propertyChange")] 
    public function get isValid() : Boolean
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_isValid;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_isValid;
        }
    }

    [Bindable(event="propertyChange")]
    public function get isIdPrestacionAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isNombreEquipoAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isDescripcionAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isIdEspecialidadAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isIdEquipoAvailable():Boolean
    {
        return true;
    }


    /**
     * derived property recalculation
     */
    public function invalidateDependentOnIdPrestacion():void
    {
        if (model_internal::_idPrestacionIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfIdPrestacion = null;
            model_internal::calculateIdPrestacionIsValid();
        }
    }
    public function invalidateDependentOnNombreEquipo():void
    {
        if (model_internal::_nombreEquipoIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfNombreEquipo = null;
            model_internal::calculateNombreEquipoIsValid();
        }
    }
    public function invalidateDependentOnDescripcion():void
    {
        if (model_internal::_descripcionIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfDescripcion = null;
            model_internal::calculateDescripcionIsValid();
        }
    }
    public function invalidateDependentOnIdEspecialidad():void
    {
        if (model_internal::_idEspecialidadIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfIdEspecialidad = null;
            model_internal::calculateIdEspecialidadIsValid();
        }
    }
    public function invalidateDependentOnIdEquipo():void
    {
        if (model_internal::_idEquipoIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfIdEquipo = null;
            model_internal::calculateIdEquipoIsValid();
        }
    }

    model_internal function fireChangeEvent(propertyName:String, oldValue:Object, newValue:Object):void
    {
        this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, propertyName, oldValue, newValue));
    }

    [Bindable(event="propertyChange")]   
    public function get idPrestacionStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get idPrestacionValidator() : StyleValidator
    {
        return model_internal::_idPrestacionValidator;
    }

    model_internal function set _idPrestacionIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_idPrestacionIsValid;         
        if (oldValue !== value)
        {
            model_internal::_idPrestacionIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "idPrestacionIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get idPrestacionIsValid():Boolean
    {
        if (!model_internal::_idPrestacionIsValidCacheInitialized)
        {
            model_internal::calculateIdPrestacionIsValid();
        }

        return model_internal::_idPrestacionIsValid;
    }

    model_internal function calculateIdPrestacionIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_idPrestacionValidator.validate(model_internal::_instance.idPrestacion)
        model_internal::_idPrestacionIsValid_der = (valRes.results == null);
        model_internal::_idPrestacionIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::idPrestacionValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::idPrestacionValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get idPrestacionValidationFailureMessages():Array
    {
        if (model_internal::_idPrestacionValidationFailureMessages == null)
            model_internal::calculateIdPrestacionIsValid();

        return _idPrestacionValidationFailureMessages;
    }

    model_internal function set idPrestacionValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_idPrestacionValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_idPrestacionValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "idPrestacionValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get nombreEquipoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get nombreEquipoValidator() : StyleValidator
    {
        return model_internal::_nombreEquipoValidator;
    }

    model_internal function set _nombreEquipoIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_nombreEquipoIsValid;         
        if (oldValue !== value)
        {
            model_internal::_nombreEquipoIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "nombreEquipoIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get nombreEquipoIsValid():Boolean
    {
        if (!model_internal::_nombreEquipoIsValidCacheInitialized)
        {
            model_internal::calculateNombreEquipoIsValid();
        }

        return model_internal::_nombreEquipoIsValid;
    }

    model_internal function calculateNombreEquipoIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_nombreEquipoValidator.validate(model_internal::_instance.nombreEquipo)
        model_internal::_nombreEquipoIsValid_der = (valRes.results == null);
        model_internal::_nombreEquipoIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::nombreEquipoValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::nombreEquipoValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get nombreEquipoValidationFailureMessages():Array
    {
        if (model_internal::_nombreEquipoValidationFailureMessages == null)
            model_internal::calculateNombreEquipoIsValid();

        return _nombreEquipoValidationFailureMessages;
    }

    model_internal function set nombreEquipoValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_nombreEquipoValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_nombreEquipoValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "nombreEquipoValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get descripcionStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get descripcionValidator() : StyleValidator
    {
        return model_internal::_descripcionValidator;
    }

    model_internal function set _descripcionIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_descripcionIsValid;         
        if (oldValue !== value)
        {
            model_internal::_descripcionIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "descripcionIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get descripcionIsValid():Boolean
    {
        if (!model_internal::_descripcionIsValidCacheInitialized)
        {
            model_internal::calculateDescripcionIsValid();
        }

        return model_internal::_descripcionIsValid;
    }

    model_internal function calculateDescripcionIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_descripcionValidator.validate(model_internal::_instance.descripcion)
        model_internal::_descripcionIsValid_der = (valRes.results == null);
        model_internal::_descripcionIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::descripcionValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::descripcionValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get descripcionValidationFailureMessages():Array
    {
        if (model_internal::_descripcionValidationFailureMessages == null)
            model_internal::calculateDescripcionIsValid();

        return _descripcionValidationFailureMessages;
    }

    model_internal function set descripcionValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_descripcionValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_descripcionValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "descripcionValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get idEspecialidadStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get idEspecialidadValidator() : StyleValidator
    {
        return model_internal::_idEspecialidadValidator;
    }

    model_internal function set _idEspecialidadIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_idEspecialidadIsValid;         
        if (oldValue !== value)
        {
            model_internal::_idEspecialidadIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "idEspecialidadIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get idEspecialidadIsValid():Boolean
    {
        if (!model_internal::_idEspecialidadIsValidCacheInitialized)
        {
            model_internal::calculateIdEspecialidadIsValid();
        }

        return model_internal::_idEspecialidadIsValid;
    }

    model_internal function calculateIdEspecialidadIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_idEspecialidadValidator.validate(model_internal::_instance.idEspecialidad)
        model_internal::_idEspecialidadIsValid_der = (valRes.results == null);
        model_internal::_idEspecialidadIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::idEspecialidadValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::idEspecialidadValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get idEspecialidadValidationFailureMessages():Array
    {
        if (model_internal::_idEspecialidadValidationFailureMessages == null)
            model_internal::calculateIdEspecialidadIsValid();

        return _idEspecialidadValidationFailureMessages;
    }

    model_internal function set idEspecialidadValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_idEspecialidadValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_idEspecialidadValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "idEspecialidadValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get idEquipoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get idEquipoValidator() : StyleValidator
    {
        return model_internal::_idEquipoValidator;
    }

    model_internal function set _idEquipoIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_idEquipoIsValid;         
        if (oldValue !== value)
        {
            model_internal::_idEquipoIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "idEquipoIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get idEquipoIsValid():Boolean
    {
        if (!model_internal::_idEquipoIsValidCacheInitialized)
        {
            model_internal::calculateIdEquipoIsValid();
        }

        return model_internal::_idEquipoIsValid;
    }

    model_internal function calculateIdEquipoIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_idEquipoValidator.validate(model_internal::_instance.idEquipo)
        model_internal::_idEquipoIsValid_der = (valRes.results == null);
        model_internal::_idEquipoIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::idEquipoValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::idEquipoValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get idEquipoValidationFailureMessages():Array
    {
        if (model_internal::_idEquipoValidationFailureMessages == null)
            model_internal::calculateIdEquipoIsValid();

        return _idEquipoValidationFailureMessages;
    }

    model_internal function set idEquipoValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_idEquipoValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_idEquipoValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "idEquipoValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }


     /**
     * 
     * @inheritDoc 
     */ 
     override public function getStyle(propertyName:String):com.adobe.fiber.styles.IStyle
     {
         switch(propertyName)
         {
            default:
            {
                return null;
            }
         }
     }
     
     /**
     * 
     * @inheritDoc 
     *  
     */  
     override public function getPropertyValidationFailureMessages(propertyName:String):Array
     {
         switch(propertyName)
         {
            case("idPrestacion"):
            {
                return idPrestacionValidationFailureMessages;
            }
            case("nombreEquipo"):
            {
                return nombreEquipoValidationFailureMessages;
            }
            case("descripcion"):
            {
                return descripcionValidationFailureMessages;
            }
            case("idEspecialidad"):
            {
                return idEspecialidadValidationFailureMessages;
            }
            case("idEquipo"):
            {
                return idEquipoValidationFailureMessages;
            }
            default:
            {
                return emptyArray;
            }
         }
     }

}

}
